﻿using Hotel_Project.HotelForm;
using Hotel_Project.Tools.MySqlData_Helps;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Hotel_Project.BIZ
{
    public class Vip_Maintenance_Jjh_BIZ
    {
        public void Initialize(DataGridView date) {
            date.Rows.Clear();
            foreach (DataRow item in Dao_MySql_Jjh.Read_Ececut($"SELECT * FROM urse_vip").Tables[0].Rows) {
                date.Rows.Add(item[0], item[1], item[2], item[5], item[6], item[7], item[4]);
            }
        }
        public void Initialize_Date(DataGridView date,string str)
        {
            date.Rows.Clear();
            if (str == "全部")
            {
                foreach (DataRow item in Dao_MySql_Jjh.Read_Ececut($"SELECT * FROM urse_vip").Tables[0].Rows)
                {
                    date.Rows.Add(item[0], item[1], item[2], item[5], item[6], item[7], item[4]);
                }
            }
            else if (str == "金卡")
            {
                foreach (DataRow item in Dao_MySql_Jjh.Read_Ececut($"SELECT * FROM urse_vip where CardType='{str}'").Tables[0].Rows)
                {
                    date.Rows.Add(item[0], item[1], item[2], item[5], item[6], item[7], item[4]);
                }
            }
            else {
                foreach (DataRow item in Dao_MySql_Jjh.Read_Ececut($"SELECT * FROM urse_vip where CardType='{str}'").Tables[0].Rows)
                {
                    date.Rows.Add(item[0], item[1], item[2], item[5], item[6], item[7], item[4]);
                }
            }
            
        }
    }
}
